﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="entityList.aspx.cs" Inherits="NetWebControl.ControlTest.OA.entityList" %>

<%@ Register assembly="ARS" namespace="ARS.Control.Custom.Entity.Widget" tagprefix="cc1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>


        <cc1:EntityModifyList ID="EntityModifyList1" runat="server">
        </cc1:EntityModifyList>
        <input id="entity_number" name="entity_number" type="text" style="display:none" />
        <input id="Button_add_entity" onclick="Add_Entity()" type="button" value="添加一项" />
        <input id="Button_del_entity" onclick="Delete_Entity()" type="button" value="删除一项" />
        <script>
            var entity_Number = 3;
            var firstObjId = "#table_entity_" + entity_Number;
            var firstObj = $(firstObjId);
            var formAction = $("form").attr("action");
            function Add_Entity() {
                var obj = firstObj;
                obj.find("td").children().each(function () {
                    //alert(this.Remark);
                    //this.Remark=this.Remark+entity_Number;
                    this.name = this.name + entity_Number;
                });

                //alert(firstObj.find("td").length);

                //alert(obj.html());
                entity_Number += 1;
                var newId = "table_entity_" + entity_Number;


                
                $("#EntityModifyList1").append("第" + entity_Number + "项" + "<table id=" + newId + "\">" + obj.html() + "</table>");
                // obj.after("第" + entity_Number + "项" + "<table id=" + newId + "\">" + obj.html() + "</table>");
                
                //alert($("#" + newId).html());
                //$("#" + newId).children().each(function () {
                //    this.Remark = "a";
                //});
                //$("form").attr("action",formAction+"?")
                $("#entity_number").val(entity_Number);
            }
            function Delete_Entity() {
                alert($("#table_entity_" + entity_Number).html());
                $("#table_entity_" + entity_Number).remove();
            }
            
        
        </script>
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
    </div>
    </form>
</body>
</html>
